package com.dc.web.controller;

import com.dc.dao.vo.calibration_stat.CalibrationStat;
import com.dc.model.AjaxResult;
import com.dc.service.CalibrationService;
import com.dc.service.CalibrationStatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 工序标定统计指标
 *
 */

@Api(tags = "工序标定统计界面")
@RestController
@RequestMapping("/api/calibration/stat")
@Slf4j
public class CalibrationStatController {

    @Resource
    private CalibrationStatService calibrationStatService;
    @Autowired
    private CalibrationService calibrationService;

    /**
     * 碳工序标定  一级表
     */
    @ApiOperation("碳工序标定  一级表")
    @GetMapping("")
    public AjaxResult getCalibrationStat() {

        List<CalibrationStat> stats = calibrationStatService.getStats();

        return AjaxResult.success(stats);

    }

    /**
     * 二级界面 船体下料
     */
    @ApiOperation("二级界面-船体下料")
    @GetMapping("/ship_cut/second")
    public AjaxResult getShipCutSecond() {
        Map<String, Object> map = calibrationStatService.shipCutSecond();
        return AjaxResult.success(map);
    }

    /**
     * 三级界面 船体下料
     */
    @ApiOperation("三级界面 船体下料")
    @GetMapping("/ship_cut/third")
    public AjaxResult getShipCutThird() {
        Map<String, Object> map = calibrationStatService.shipCutThird();
        return AjaxResult.success(map);
    }

    /**
     * 二级界面 船体割旧
     */
    @ApiOperation("二级界面 船体割旧")
    @GetMapping("/ship_old/second")
    public AjaxResult getShipOldSecond() {
        Map<String, Object> map = calibrationStatService.shipOldSecond();
        return AjaxResult.success(map);
    }

    /**
     * 三级界面 船体割旧
     */
    @ApiOperation("三级界面 船体割旧")
    @GetMapping("/ship_old/third")
    public AjaxResult getShipOldThird() {
        Map<String, Object> map = calibrationStatService.shipOldThird();
        return AjaxResult.success(map);
    }

    /**
     * 二级界面 船体焊接
     */
    @ApiOperation("二级界面 船体焊接")
    @GetMapping("/ship_weld/second")
    public AjaxResult getShipWeldSecond() {
        Map<String, Object> map = calibrationStatService.shipWeldSecond();
        return AjaxResult.success(map);
    }

    /**
     * 三级界面 船体焊接
     */
    @ApiOperation("三级界面 船体焊接")
    @GetMapping("/ship_weld/third")
    public AjaxResult getShipWeldThird() {
        Map<String, Object> map = calibrationStatService.shipWeldThird();
        return AjaxResult.success(map);
    }

    /**
     * 二级界面 机电管子
     */
    @ApiOperation("二级界面 机电管子")
    @GetMapping("/machine_pipe/second")
    public AjaxResult getMachinePipeSecond(String type, String method) {
        Map<String, Object> map = calibrationStatService.machinePipeSecond(type, method);
        return AjaxResult.success(map);
    }

    /**
     * 4 二级界面 喷涂房
     */
    @ApiOperation("二级界面 喷漆房分段喷漆")
    @GetMapping("/paint_house/second")
    public AjaxResult getPaintHouseSecond() {
        Map<String, Object> map = calibrationStatService.paintHouseSecond();
        return AjaxResult.success(map);
    }

    /**
     * 4 三级界面 喷涂房
     */
    @ApiOperation("三级界面 喷漆房分段喷漆")
    @GetMapping("/paint_house/third")
    public AjaxResult getPaintHouseThird() {
        Map<String, Object> map = calibrationStatService.paintHouseThird();
        return AjaxResult.success(map);
    }

    /**
     * 4 二级界面 舱室及船壳
     */
    @ApiOperation("二级界面 舱室和船壳喷漆")
    @GetMapping("/paint_ship/second")
    public AjaxResult getPaintShipSecond() {
        Map<String, Object> map = calibrationStatService.paintShipSecond();
        return AjaxResult.success(map);
    }

    /**
     * 4 三级界面 舱室及船壳
     */
    @ApiOperation("三级界面 舱室和船壳喷漆")
    @GetMapping("/paint_ship/third")
    public AjaxResult getPaintShipThird() {
        Map<String, Object> map = calibrationStatService.paintShipThird();
        return AjaxResult.success(map);
    }

    /**
     * 5 二级界面 打砂房
     */
    @ApiOperation("二级界面 打砂房分段打砂")
    @GetMapping("/sand_house/second")
    public AjaxResult getSandHouseSecond() {
        Map<String, Object> map = calibrationStatService.sandHouseSecond();
        return AjaxResult.success(map);
    }

    /**
     * 5 三级界面 打砂房
     */
    @ApiOperation("三级界面 打砂房分段打砂")
    @GetMapping("/sand_house/third")
    public AjaxResult getSandHouseThird() {
        Map<String, Object> map = calibrationStatService.sandHouseThird();
        return AjaxResult.success(map);
    }

    /**
     * 5 二级界面 舱室打砂
     */
    @ApiOperation("二级界面 舱室打砂")
    @GetMapping("/sand_ship/second")
    public AjaxResult getSandShipSecond() {
        Map<String, Object> map = calibrationStatService.sandShipSecond();
        return AjaxResult.success(map);
    }

    /**
     * 5 三级界面 舱室打砂
     */
    @ApiOperation("三级界面 舱室打砂")
    @GetMapping("/sand_ship/third")
    public AjaxResult getSandShipThird() {
        Map<String, Object> map = calibrationStatService.sandShipThird();
        return AjaxResult.success(map);
    }

    /**
     * 6 二级界面 超水清洁点打
     */
    @ApiOperation("二级界面 超水清洁点打")
    @GetMapping("/water_clean_point/second")
    public AjaxResult getWaterCleanPointSecond() {
        Map<String, Object> map = calibrationStatService.waterCleanPointSecond();
        return AjaxResult.success(map);
    }

    /**
     * 6 三级界面 超水清洁点打
     */
    @ApiOperation("三级界面 超水清洁点打")
    @GetMapping("/water_clean_point/third")
    public AjaxResult getWaterCleanPointThird() {
        Map<String, Object> map = calibrationStatService.waterCleanPointThird();
        return AjaxResult.success(map);
    }

    /**
     * 6 二级界面 超水清洁
     */
    @ApiOperation("二级界面 超水清洁")
    @GetMapping("/water_clean/second")
    public AjaxResult getWaterCleanSecond() {
        Map<String, Object> map = calibrationStatService.waterCleanSecond();
        return AjaxResult.success(map);
    }

    /**
     * 6 三级界面 超水清洁
     */
    @ApiOperation("三级界面 超水清洁")
    @GetMapping("/water_clean/third")
    public AjaxResult getWaterCleanThird() {
        Map<String, Object> map = calibrationStatService.waterCleanThird();
        return AjaxResult.success(map);
    }

    /**
     * 6 二级界面 超水除锈
     */
    @ApiOperation("二级界面 超水除锈")
    @GetMapping("/water_clean_rust/second")
    public AjaxResult getWaterCleanRustSecond() {
        Map<String, Object> map = calibrationStatService.waterCleanRustSecond();
        return AjaxResult.success(map);
    }

    /**
     * 6 三级界面 超水除锈
     */
    @ApiOperation("三级界面 超水除锈")
    @GetMapping("/water_clean_rust/third")
    public AjaxResult getWaterCleanRustThird() {
        Map<String, Object> map = calibrationStatService.waterCleanRustThird();
        return AjaxResult.success(map);
    }

    /**
     * 6 二级界面 舱盖超水除锈
     */
    @ApiOperation("二级界面 舱盖超水除锈")
    @GetMapping("/water_clean_rust_ship/second")
    public AjaxResult getWaterCleanRustShipSecond() {
        Map<String, Object> map = calibrationStatService.waterCleanRustShipSecond();
        return AjaxResult.success(map);
    }

    /**
     * 6 三级界面 舱盖超水除锈
     */
    @ApiOperation("三级界面 舱盖超水除锈")
    @GetMapping("/water_clean_rust_ship/third")
    public AjaxResult getWaterCleanRustShipThird() {
        Map<String, Object> map = calibrationStatService.waterCleanRustShipThird();
        return AjaxResult.success(map);
    }



    /**
     * 压缩空气气电转换标定统计表
     */
    @ApiOperation("压缩空气气电转换标定统计表")
    @GetMapping("/unit_air_power")
    public AjaxResult getUnitAirPower() {
        Map<String, Object> map = calibrationStatService.unitAirPower();
        return AjaxResult.success(map);
    }

    /**
     * 空气气电转换标定
     */
    @ApiOperation("单位压缩空气量耗电量标定值")
    @GetMapping("/air_calibration_value")
    public AjaxResult getAirCalibrationValue() {
        Double v = calibrationService.calcUnitAirPower();
        return AjaxResult.success(v);
    }
}
